﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BDS3M.Admin.Controls
{
    public partial class ViewContact : System.Web.UI.UserControl
    {
        public string hoten;
        public string diachi;
        public string email;
        public string company;
        public string tieude;
        public string noidung;
        public string date;
        public int id;
        protected void Page_Load(object sender, EventArgs e)
        {
            
                if (Request.QueryString["contid"] != null)
                {
                    id = Convert.ToInt32(Request.QueryString["contid"]);
                    DataTable dt = DAL.DCollector.DBCollector.Instance.StoredSelectAllTableWhereID("tbl_LienHe", "LienHe_ID", id.ToString());
                    hoten = dt.Rows[0]["LienHe_HoTen"].ToString();
                    diachi = dt.Rows[0]["LienHe_DiaChi"].ToString();
                    email = dt.Rows[0]["LienHe_Email"].ToString();
                    company = dt.Rows[0]["LienHe_Company"].ToString();
                    tieude = dt.Rows[0]["LienHe_TieuDe"].ToString();
                    noidung = dt.Rows[0]["LienHe_NoiDung"].ToString();
                    date = dt.Rows[0]["LienHe_Date"].ToString();
                    txtHoten.Text = hoten;
                    txtDiachi.Text = diachi;
                    txtCompany.Text = company;
                    txtEmail.Text = email;
                    txtTitle.Text = tieude;
                    CKEditorNoidung.Text = noidung;
                    txtDate.Text = date;
                }
            
        }

        protected void lbtDelete_Click(object sender, EventArgs e)
        {
            id = Convert.ToInt32(Request.QueryString["contid"]);
            DAL.DCollector.DBCollector.Instance.StoredProcedureDeleteByRows("tbl_LienHe", "LienHe_ID", id.ToString());
            Response.Redirect("/Admin/Index.aspx?panel=7&sub=6");
        }
    }
}